﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TCL.UC
{
    public partial class Label_TexboxUC : UserControl
    {
        public Label_TexboxUC()
        {
            InitializeComponent();
        }

        public void NMT_setInputInit(String Title, String DefaultValue, String DefaultMsg, Boolean isReadOnly)
        {
            lblTitle.Text = Title;
            
            txtInput.Text = DefaultValue;
            txtInput.ReadOnly = isReadOnly;

            lblMsg.Text = DefaultMsg;
        }

        public void NMT_setInput(String Value)
        {
            txtInput.Text = Value;
        }

        public String NMT_getInput(Boolean isRequired)
        {
            lblMsg.Text = null;
            if (isRequired)
                if (String.IsNullOrEmpty(txtInput.Text))
                {
                    txtInput.Focus();
                    lblMsg.Text = "(*) " + lblTitle.Text.Replace(":", "");
                    return "";
                }
            return txtInput.Text;
        }

        public void NMT_setRequired(String sRequired)
        {
            lblMsg.Text = "(*) " + sRequired;
        }
    }
}
